package com.yupi.yuoj.judge.codesandbox;

import com.yupi.yuoj.judge.codesandbox.impl.ExampleCodeSandbox;
import com.yupi.yuoj.judge.codesandbox.impl.RemoteCodeSandbox;
import com.yupi.yuoj.judge.codesandbox.impl.ThirdPartyCodeSandbox;


/**
 * @Author: wenjupeng
 * @Date: 2025/01/17/16:06
 * @Description:代码沙箱工厂（根据字符串参数创建指定的代码沙箱实例）
 * @Param:
 * @return:
 */
public class CodeSandboxFactory {
    /**
     * 创建代码沙箱示例
     * @param type  沙箱类型
     * @return
     */
    public static  CodeSandbox newInstance(String type){
        switch (type){
            case "example":
                return new ExampleCodeSandbox();
            case "remote":
                return new RemoteCodeSandbox();
            case "thirdParty":
                return new ThirdPartyCodeSandbox();
            default:
                return new ExampleCodeSandbox();
        }
    
    }
    
  
}
